import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param str string字符串 
     * @return bool布尔型
     */
    int index = 0;
    char[] c;

    public boolean isInteger () {
        if (index < c.length && (c[index] == '+' || c[index] == '-')) {
            index++;
        }

        return isUnsignedInteger(); 
    }

    public boolean isUnsignedInteger () {
        int temp = index;
        
        while (index < c.length && Character.isDigit(c[index])) {
            index++;
        }

        return index > temp;
    }



    public boolean isNumeric (String str) {
        // write code here
        // 去除前后空格
        str = str.trim();

        if (str == null || str.length() == 0) {
            return false;
        }

        c = str.toCharArray();

        boolean res = isInteger();

        if (index < c.length && c[index] == '.') {
            index++;
            res = isUnsignedInteger() || res;
        }

        if (index < c.length && (c[index] == 'e' || c[index] == 'E')) {
            index++;
            res = isInteger() && res;
        }
        return res && (index == c.length);
    }
}